package c;



import java.util.function.Supplier;


public class Demo {
    public static int getMax(int[] arr, Supplier<Integer> sup){
        return sup.get();
    }
    public static Integer getInstance(int[] arr, Supplier<Integer> sup) {
        return sup.get();
    }

    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        int a = getMax(arr,() -> {
            int max = arr[0];
            for (int i:arr) {
                if(arr[i] > max){
                    max = arr[i];
                }
            }
            return max;
        });
        System.out.println(a);
    }
}
